//
//  Utility.h
//  Dungeons and Princesses
//
//  Created by John Grange on 10/15/11.
//  Copyright (c) 2011 SD Networks. All rights reserved.
//

#ifndef Dungeons_and_Princesses_Utility_h
#define Dungeons_and_Princesses_Utility_h

#include <sstream>
#include <string.h>
#include <algorithm>
#include "Inventory.h"

class Utility {
public:
    static string lowerCase(std::string stringToConvert)
    {
        std::string lowerCaseString = stringToConvert;
        transform (lowerCaseString.begin(), lowerCaseString.end(), lowerCaseString.begin(), ::tolower);
        
        return lowerCaseString;
    }
    
    static void getCommands(std::string commandToParse, vector<string> &commandsToPassBack) {
        
        //string command[size];
        string subCommand;
        istringstream iss(commandToParse);
        //int count = 0;
        while (getline (iss, subCommand, ' '))
        {
            commandsToPassBack.push_back(subCommand);
            
        }
        
    }
    
    static string removeGarbage(std::string stringToStrip) {
        
        stringToStrip.erase(stringToStrip.find_last_not_of(" \n\r\t")+1);
        
        return stringToStrip;
    }
    
    static void printListingOBject(Listing invObject) {
        
       std::cout << invObject.description << std::endl;
    }
};
#endif
